from lib.net.index import wlan
import asyncio
from lib.websocket import action
from lib.server.core import Main

wlan.connect()


async def ws_connect():
    await action.connect()
    await action.heart_beat()
    data = await action.read()
    # print(f"ws {interval} recv:", data)
    await asyncio.sleep(3)


async def main():
    asyncio.create_task(Main("http", 80))
    while True:
        asyncio.create_task(ws_connect())
        await asyncio.sleep_ms(1_000)


asyncio.run(main())
